home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / Editions.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  16KB  |  451 lines

  1. /*
  2.      File:        Editions.h
  3.  
  4.      Contains:    Edition Manager Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __EDITIONS__
  19. #define __EDITIONS__
  20.  
  21. #ifndef __MEMORY__
  22. #include <Memory.h>
  23. #endif
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. #ifndef __FILES__
  28. #include <Files.h>
  29. #endif
  30. #ifndef __ALIASES__
  31. #include <Aliases.h>
  32. #endif
  33. #ifndef __DIALOGS__
  34. #include <Dialogs.h>
  35. #endif
  36.  
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif
  40.  
  41. #if PRAGMA_IMPORT_SUPPORTED
  42. #pragma import on
  43. #endif
  44.  
  45. #if PRAGMA_ALIGN_SUPPORTED
  46. #pragma options align=mac68k
  47. #endif
  48.  
  49. #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED
  50.  
  51. enum {
  52.                                                                 /* resource types  */
  53.     rSectionType                = 'sect',                        /* ResType of saved SectionRecords */
  54.                                                                 /* Finder types for edition files */
  55.     kPICTEditionFileType        = 'edtp',
  56.     kTEXTEditionFileType        = 'edtt',
  57.     ksndEditionFileType            = 'edts',
  58.     kUnknownEditionFileType        = 'edtu',
  59.     kPublisherDocAliasFormat    = 'alis',
  60.     kPreviewFormat                = 'prvw',
  61.     kFormatListFormat            = 'fmts'
  62. };
  63.  
  64.  
  65. enum {
  66.                                                                 /* section types */
  67.     stSubscriber                = 0x01,
  68.     stPublisher                    = 0x0A,
  69.     sumAutomatic                = 0,                            /* subscriber update mode - Automatically     */
  70.     sumManual                    = 1,                            /* subscriber update mode - Manually */
  71.     pumOnSave                    = 0,                            /* publisher update mode - OnSave            */
  72.     pumManual                    = 1,                            /* publisher update mode - Manually */
  73.     kPartsNotUsed                = 0,
  74.     kPartNumberUnknown            = -1,                            /* misc */
  75.     kPreviewWidth                = 120,
  76.     kPreviewHeight                = 120,                            /* bits for formatsMask */
  77.     kPICTformatMask                = 1,
  78.     kTEXTformatMask                = 2,
  79.     ksndFormatMask                = 4
  80. };
  81.  
  82. /*
  83.  pseudo-item hits for dialogHooks 
  84.  the first if for NewPublisher or NewSubscriber Dialogs 
  85. */
  86.  
  87. enum {
  88.     emHookRedrawPreview            = 150,                            /* the following are for SectionOptions Dialog */
  89.     emHookCancelSection            = 160,
  90.     emHookGoToPublisher            = 161,
  91.     emHookGetEditionNow            = 162,
  92.     emHookSendEditionNow        = 162,
  93.     emHookManualUpdateMode        = 163,
  94.     emHookAutoUpdateMode        = 164
  95. };
  96.  
  97. /*
  98.  the refcon field of the dialog record during a modalfilter 
  99.  or dialoghook contains one the following 
  100. */
  101.  
  102. enum {
  103.     emOptionsDialogRefCon        = 'optn',
  104.     emCancelSectionDialogRefCon    = 'cncl',
  105.     emGoToPubErrDialogRefCon    = 'gerr',
  106.     kFormatLengthUnknown        = -1
  107. };
  108.  
  109. /* one byte, stSubscriber or stPublisher */
  110. typedef SignedByte SectionType;
  111. /* seconds since 1904 */
  112. typedef unsigned long TimeStamp;
  113. /* similar to ResType */
  114. typedef FourCharCode FormatType;
  115. /* used in Edition I/O */
  116. typedef Handle EditionRefNum;
  117. /* update modes */
  118. /* sumAutomatic, pumSuspend, etc */
  119. typedef short UpdateMode;
  120. typedef struct SectionRecord SectionRecord;
  121. typedef SectionRecord *SectionPtr;
  122. typedef SectionPtr *SectionHandle;
  123. struct SectionRecord {
  124.     SignedByte                         version;                    /* always 0x01 in system 7.0 */
  125.     SectionType                     kind;                        /* stSubscriber or stPublisher */
  126.     UpdateMode                         mode;                        /* auto or manual */
  127.     TimeStamp                         mdDate;                        /* last change in document */
  128.     long                             sectionID;                    /* app. specific, unique per document */
  129.     long                             refCon;                        /* application specific */
  130.     AliasHandle                     alias;                        /* handle to Alias Record */
  131.     long                             subPart;                    /* which part of container file */
  132.     SectionHandle                     nextSection;                /* for linked list of app's Sections */
  133.     Handle                             controlBlock;                /* used internally */
  134.     EditionRefNum                     refNum;                        /* used internally */
  135. };
  136.  
  137. struct EditionContainerSpec {
  138.     FSSpec                             theFile;
  139.     ScriptCode                         theFileScript;
  140.     long                             thePart;
  141.     Str31                             thePartName;
  142.     ScriptCode                         thePartScript;
  143. };
  144. typedef struct EditionContainerSpec EditionContainerSpec;
  145.  
  146. typedef EditionContainerSpec *EditionContainerSpecPtr;
  147. struct EditionInfoRecord {
  148.     TimeStamp                         crDate;                        /* date EditionContainer was created */
  149.     TimeStamp                         mdDate;                        /* date of last change */
  150.     OSType                             fdCreator;                    /* file creator */
  151.     OSType                             fdType;                        /* file type */
  152.     EditionContainerSpec             container;                    /* the Edition */
  153. };
  154. typedef struct EditionInfoRecord EditionInfoRecord;
  155.  
  156. struct NewPublisherReply {
  157.     Boolean                         canceled;                    /* O */
  158.     Boolean                         replacing;
  159.     Boolean                         usePart;                    /* I */
  160.     SInt8                             filler;
  161.     Handle                             preview;                    /* I */
  162.     FormatType                         previewFormat;                /* I */
  163.     EditionContainerSpec             container;                    /* I/O */
  164. };
  165. typedef struct NewPublisherReply NewPublisherReply;
  166.  
  167. struct NewSubscriberReply {
  168.     Boolean                         canceled;                    /* O */
  169.     SignedByte                         formatsMask;
  170.     EditionContainerSpec             container;                    /*I/O*/
  171. };
  172. typedef struct NewSubscriberReply NewSubscriberReply;
  173.  
  174. struct SectionOptionsReply {
  175.     Boolean                         canceled;                    /* O */
  176.     Boolean                         changed;                    /* O */
  177.     SectionHandle                     sectionH;                    /* I */
  178.     ResType                         action;                        /* O */
  179. };
  180. typedef struct SectionOptionsReply SectionOptionsReply;
  181.  
  182. typedef pascal Boolean (*ExpModalFilterProcPtr)(DialogPtr theDialog, EventRecord *theEvent, short itemOffset, short *itemHit, Ptr yourDataPtr);
  183. typedef pascal short (*ExpDlgHookProcPtr)(short itemOffset, short itemHit, DialogPtr theDialog, Ptr yourDataPtr);
  184.  
  185. #if GENERATINGCFM
  186. typedef UniversalProcPtr ExpModalFilterUPP;
  187. typedef UniversalProcPtr ExpDlgHookUPP;
  188. #else
  189. typedef ExpModalFilterProcPtr ExpModalFilterUPP;
  190. typedef ExpDlgHookProcPtr ExpDlgHookUPP;
  191. #endif
  192.  
  193. enum {
  194.     uppExpModalFilterProcInfo = kPascalStackBased
  195.          | RESULT_SIZE(SIZE_CODE(sizeof(Boolean)))
  196.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(DialogPtr)))
  197.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EventRecord *)))
  198.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(short)))
  199.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(short *)))
  200.          | STACK_ROUTINE_PARAMETER(5, SIZE_CODE(sizeof(Ptr))),
  201.     uppExpDlgHookProcInfo = kPascalStackBased
  202.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  203.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(short)))
  204.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(short)))
  205.          | STACK_ROUTINE_PARAMETER(3, SIZE_CODE(sizeof(DialogPtr)))
  206.          | STACK_ROUTINE_PARAMETER(4, SIZE_CODE(sizeof(Ptr)))
  207. };
  208.  
  209. #if GENERATINGCFM
  210. #define NewExpModalFilterProc(userRoutine)        \
  211.         (ExpModalFilterUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpModalFilterProcInfo, GetCurrentArchitecture())
  212. #define NewExpDlgHookProc(userRoutine)        \
  213.         (ExpDlgHookUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppExpDlgHookProcInfo, GetCurrentArchitecture())
  214. #else
  215. #define NewExpModalFilterProc(userRoutine)        \
  216.         ((ExpModalFilterUPP) (userRoutine))
  217. #define NewExpDlgHookProc(userRoutine)        \
  218.         ((ExpDlgHookUPP) (userRoutine))
  219. #endif
  220.  
  221. #if GENERATINGCFM
  222. #define CallExpModalFilterProc(userRoutine, theDialog, theEvent, itemOffset, itemHit, yourDataPtr)        \
  223.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppExpModalFilterProcInfo, (theDialog), (theEvent), (itemOffset), (itemHit), (yourDataPtr))
  224. #define CallExpDlgHookProc(userRoutine, itemOffset, itemHit, theDialog, yourDataPtr)        \
  225.         CallUniversalProc((UniversalProcPtr)(userRoutine), uppExpDlgHookProcInfo, (itemOffset), (itemHit), (theDialog), (yourDataPtr))
  226. #else
  227. #define CallExpModalFilterProc(userRoutine, theDialog, theEvent, itemOffset, itemHit, yourDataPtr)        \
  228.         (*(userRoutine))((theDialog), (theEvent), (itemOffset), (itemHit), (yourDataPtr))
  229. #define CallExpDlgHookProc(userRoutine, itemOffset, itemHit, theDialog, yourDataPtr)        \
  230.         (*(userRoutine))((itemOffset), (itemHit), (theDialog), (yourDataPtr))
  231. #endif
  232.  
  233. enum {
  234.     ioHasFormat                    = 0,
  235.     ioReadFormat                = 1,
  236.     ioNewFormat                    = 2,
  237.     ioWriteFormat                = 3
  238. };
  239.  
  240. typedef SignedByte FormatIOVerb;
  241.  
  242. enum {
  243.     eoOpen                        = 0,
  244.     eoClose                        = 1,
  245.     eoOpenNew                    = 2,
  246.     eoCloseNew                    = 3,
  247.     eoCanSubscribe                = 4
  248. };
  249.  
  250. typedef SignedByte EditionOpenerVerb;
  251. struct FormatIOParamBlock {
  252.     long                             ioRefNum;
  253.     FormatType                         format;
  254.     long                             formatIndex;
  255.     unsigned long                     offset;
  256.     Ptr                             buffPtr;
  257.     unsigned long                     buffLen;
  258. };
  259. typedef struct FormatIOParamBlock FormatIOParamBlock;
  260.  
  261. typedef struct EditionOpenerParamBlock EditionOpenerParamBlock;
  262. typedef pascal short (*FormatIOProcPtr)(FormatIOVerb selector, FormatIOParamBlock *PB);
  263. typedef pascal short (*EditionOpenerProcPtr)(EditionOpenerVerb selector, EditionOpenerParamBlock *PB);
  264.  
  265. #if GENERATINGCFM
  266. typedef UniversalProcPtr FormatIOUPP;
  267. typedef UniversalProcPtr EditionOpenerUPP;
  268. #else
  269. typedef FormatIOProcPtr FormatIOUPP;
  270. typedef EditionOpenerProcPtr EditionOpenerUPP;
  271. #endif
  272. struct EditionOpenerParamBlock {
  273.     EditionInfoRecord                 info;
  274.     SectionHandle                     sectionH;
  275.     const FSSpec *                    document;
  276.     OSType                             fdCreator;
  277.     long                             ioRefNum;
  278.     FormatIOUPP                     ioProc;
  279.     Boolean                         success;
  280.     SignedByte                         formatsMask;
  281. };
  282.  
  283.  
  284. enum {
  285.     uppFormatIOProcInfo = kPascalStackBased
  286.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  287.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(FormatIOVerb)))
  288.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(FormatIOParamBlock *))),
  289.     uppEditionOpenerProcInfo = kPascalStackBased
  290.          | RESULT_SIZE(SIZE_CODE(sizeof(short)))
  291.          | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(EditionOpenerVerb)))
  292.          | STACK_ROUTINE_PARAMETER(2, SIZE_CODE(sizeof(EditionOpenerParamBlock *)))
  293. };
  294.  
  295. #if GENERATINGCFM
  296. #define NewFormatIOProc(userRoutine)        \
  297.         (FormatIOUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppFormatIOProcInfo, GetCurrentArchitecture())
  298. #define NewEditionOpenerProc(userRoutine)        \
  299.         (EditionOpenerUPP) NewRoutineDescriptor((ProcPtr)(userRoutine), uppEditionOpenerProcInfo, GetCurrentArchitecture())
  300. #else
  301. #define NewFormatIOProc(userRoutine)        \
  302.         ((FormatIOUPP) (userRoutine))
  303. #define NewEditionOpenerProc(userRoutine)        \
  304.         ((EditionOpenerUPP) (userRoutine))
  305. #endif
  306. /*
  307.  Section events now arrive in the message buffer using the AppleEvent format.
  308.  The direct object parameter is an aeTemporaryIDParamType ('tid '). The temporary
  309.  ID's type is rSectionType ('sect') and the 32-bit value is a SectionHandle.
  310.  The following is a sample buffer
  311.  
  312.  name       offset     contents
  313.  ----       ------     --------
  314.  header           0      'aevt'
  315.  majorVersion     4      0x01
  316.  minorVersion     6      0x01
  317.  endOfMetaData     8      ';;;;' 
  318.  directObjKey     12  '----' 
  319.  paramType      16  'tid ' 
  320.  paramLength      20  0x0008 
  321.  tempIDType      24  'sect' 
  322.  tempID            28  the SectionHandle <-- this is want you want
  323. */
  324.  
  325. enum {
  326.     sectionEventMsgClass        = 'sect',
  327.     sectionReadMsgID            = 'read',
  328.     sectionWriteMsgID            = 'writ',
  329.     sectionScrollMsgID            = 'scrl',
  330.     sectionCancelMsgID            = 'cncl'
  331. };
  332.  
  333.  
  334. enum {
  335.     currentEditionMgrVers        = 0x0011
  336. };
  337.  
  338. #if !CFMSYSTEMCALLS
  339. extern pascal OSErr InitEditionPack(void )
  340.  FIVEWORDINLINE(0x3F3C, 0x0011, 0x303C, 0x0100, 0xA82D);
  341.  
  342. #else
  343. #define InitEditionPack() InitEditionPackVersion(currentEditionMgrVers)
  344. extern pascal OSErr InitEditionPackVersion(short curEditionMgrVers)
  345.  THREEWORDINLINE(0x303C, 0x0100, 0xA82D);
  346.  
  347. #endif
  348. extern pascal OSErr NewSection(const EditionContainerSpec *container, ConstFSSpecPtr sectionDocument, SectionType kind, long sectionID, UpdateMode initalMode, SectionHandle *sectionH)
  349.  THREEWORDINLINE(0x303C, 0x0A02, 0xA82D);
  350.  
  351. extern pascal OSErr RegisterSection(const FSSpec *sectionDocument, SectionHandle sectionH, Boolean *aliasWasUpdated)
  352.  THREEWORDINLINE(0x303C, 0x0604, 0xA82D);
  353.  
  354. extern pascal OSErr UnRegisterSection(SectionHandle sectionH)
  355.  THREEWORDINLINE(0x303C, 0x0206, 0xA82D);
  356.  
  357. extern pascal OSErr IsRegisteredSection(SectionHandle sectionH)
  358.  THREEWORDINLINE(0x303C, 0x0208, 0xA82D);
  359.  
  360. extern pascal OSErr AssociateSection(SectionHandle sectionH, const FSSpec *newSectionDocument)
  361.  THREEWORDINLINE(0x303C, 0x040C, 0xA82D);
  362.  
  363. extern pascal OSErr CreateEditionContainerFile(const FSSpec *editionFile, OSType fdCreator, ScriptCode editionFileNameScript)
  364.  THREEWORDINLINE(0x303C, 0x050E, 0xA82D);
  365.  
  366. extern pascal OSErr DeleteEditionContainerFile(const FSSpec *editionFile)
  367.  THREEWORDINLINE(0x303C, 0x0210, 0xA82D);
  368.  
  369. extern pascal OSErr OpenEdition(SectionHandle subscriberSectionH, EditionRefNum *refNum)
  370.  THREEWORDINLINE(0x303C, 0x0412, 0xA82D);
  371.  
  372. extern pascal OSErr OpenNewEdition(SectionHandle publisherSectionH, OSType fdCreator, ConstFSSpecPtr publisherSectionDocument, EditionRefNum *refNum)
  373.  THREEWORDINLINE(0x303C, 0x0814, 0xA82D);
  374.  
  375. extern pascal OSErr CloseEdition(EditionRefNum whichEdition, Boolean successful)
  376.  THREEWORDINLINE(0x303C, 0x0316, 0xA82D);
  377.  
  378. extern pascal OSErr EditionHasFormat(EditionRefNum whichEdition, FormatType whichFormat, Size *formatSize)
  379.  THREEWORDINLINE(0x303C, 0x0618, 0xA82D);
  380.  
  381. extern pascal OSErr ReadEdition(EditionRefNum whichEdition, FormatType whichFormat, void *buffPtr, Size *buffLen)
  382.  THREEWORDINLINE(0x303C, 0x081A, 0xA82D);
  383.  
  384. extern pascal OSErr WriteEdition(EditionRefNum whichEdition, FormatType whichFormat, const void *buffPtr, Size buffLen)
  385.  THREEWORDINLINE(0x303C, 0x081C, 0xA82D);
  386.  
  387. extern pascal OSErr GetEditionFormatMark(EditionRefNum whichEdition, FormatType whichFormat, unsigned long *currentMark)
  388.  THREEWORDINLINE(0x303C, 0x061E, 0xA82D);
  389.  
  390. extern pascal OSErr SetEditionFormatMark(EditionRefNum whichEdition, FormatType whichFormat, unsigned long setMarkTo)
  391.  THREEWORDINLINE(0x303C, 0x0620, 0xA82D);
  392.  
  393. extern pascal OSErr GetEditionInfo(SectionHandle sectionH, EditionInfoRecord *editionInfo)
  394.  THREEWORDINLINE(0x303C, 0x0422, 0xA82D);
  395.  
  396. extern pascal OSErr GoToPublisherSection(const EditionContainerSpec *container)
  397.  THREEWORDINLINE(0x303C, 0x0224, 0xA82D);
  398.  
  399. extern pascal OSErr GetLastEditionContainerUsed(EditionContainerSpec *container)
  400.  THREEWORDINLINE(0x303C, 0x0226, 0xA82D);
  401.  
  402. extern pascal OSErr GetStandardFormats(const EditionContainerSpec *container, FormatType *previewFormat, Handle preview, Handle publisherAlias, Handle formats)
  403.  THREEWORDINLINE(0x303C, 0x0A28, 0xA82D);
  404.  
  405. extern pascal OSErr GetEditionOpenerProc(EditionOpenerUPP *opener)
  406.  THREEWORDINLINE(0x303C, 0x022A, 0xA82D);
  407.  
  408. extern pascal OSErr SetEditionOpenerProc(EditionOpenerUPP opener)
  409.  THREEWORDINLINE(0x303C, 0x022C, 0xA82D);
  410.  
  411. extern pascal OSErr CallEditionOpenerProc(EditionOpenerVerb selector, EditionOpenerParamBlock *PB, EditionOpenerUPP routine)
  412.  THREEWORDINLINE(0x303C, 0x052E, 0xA82D);
  413.  
  414. extern pascal OSErr CallFormatIOProc(FormatIOVerb selector, FormatIOParamBlock *PB, FormatIOUPP routine)
  415.  THREEWORDINLINE(0x303C, 0x0530, 0xA82D);
  416.  
  417. extern pascal OSErr NewSubscriberDialog(NewSubscriberReply *reply)
  418.  THREEWORDINLINE(0x303C, 0x0232, 0xA82D);
  419.  
  420. extern pascal OSErr NewSubscriberExpDialog(NewSubscriberReply *reply, Point where, short expansionDITLresID, ExpDlgHookUPP dlgHook, ExpModalFilterUPP filter, void *yourDataPtr)
  421.  THREEWORDINLINE(0x303C, 0x0B34, 0xA82D);
  422.  
  423. extern pascal OSErr NewPublisherDialog(NewPublisherReply *reply)
  424.  THREEWORDINLINE(0x303C, 0x0236, 0xA82D);
  425.  
  426. extern pascal OSErr NewPublisherExpDialog(NewPublisherReply *reply, Point where, short expansionDITLresID, ExpDlgHookUPP dlgHook, ExpModalFilterUPP filter, void *yourDataPtr)
  427.  THREEWORDINLINE(0x303C, 0x0B38, 0xA82D);
  428.  
  429. extern pascal OSErr SectionOptionsDialog(SectionOptionsReply *reply)
  430.  THREEWORDINLINE(0x303C, 0x023A, 0xA82D);
  431.  
  432. extern pascal OSErr SectionOptionsExpDialog(SectionOptionsReply *reply, Point where, short expansionDITLresID, ExpDlgHookUPP dlgHook, ExpModalFilterUPP filter, void *yourDataPtr)
  433.  THREEWORDINLINE(0x303C, 0x0B3C, 0xA82D);
  434.  
  435. #endif
  436.  
  437. #if PRAGMA_ALIGN_SUPPORTED
  438. #pragma options align=reset
  439. #endif
  440.  
  441. #if PRAGMA_IMPORT_SUPPORTED
  442. #pragma import off
  443. #endif
  444.  
  445. #ifdef __cplusplus
  446. }
  447. #endif
  448.  
  449. #endif /* __EDITIONS__ */
  450.  
  451.